package com.tcy.game.angryrobots;

import com.badlogic.gdx.utils.Array;

/**
 * Created by 80002023 on 2016/7/27.
 */
public class ScoreNotifier  implements ScoreListener {

    private Array<ScoreListener> listeners;

    public ScoreNotifier () {
        listeners = new Array<ScoreListener>();
    }

    public void addListener (ScoreListener listener) {
        listeners.add(listener);
    }

    @Override
    public void onScoreChanged (int score) {
        for (ScoreListener listener : listeners) {
            listener.onScoreChanged(score);
        }
    }

    @Override
    public void onLivesChanged (int lives) {
        for (ScoreListener listener : listeners) {
            listener.onLivesChanged(lives);
        }
    }
}
